import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'

// https://vitejs.dev/config/
export default defineConfig({
  build: {
    // 开发阶段启用源码映射：https://uniapp.dcloud.net.cn/tutorial/migration-to-vue3.html#需主动开启-sourcemap
    // sourcemap: process.env.NODE_ENV === 'development',
    sourcemap: false,
  },
  plugins: [uni()],
  server: {
    port: 5173,
    proxy: {
      '^/nirons-admin/.*': {
        target: 'http://hk.ht1y.com',
        // target: 'http://localhost:8080',
        ws: false,
        changeOrigin: true,
        // configure: (proxy, options) => {
        //   proxy.on('proxyReq', (proxyReq, req, res) => {
        //     console.log('Proxying:', req.method, req.url, '=>', options)
        //   })
        //   proxy.on('error', (err, req, res) => {
        //     console.error('Proxy error:', err)
        //   })
        // }
      }
    }
  }
})
